<%@ page import="java.util.ArrayList" %>
<%@ page import="MySql.*" %><%--
  Created by IntelliJ IDEA.
  User: 浅汐
  Date: 2021/1/15
  Time: 17:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/manager.css">
</head>

<body>
<div class="top">
    PetWeb后台管理系统
</div>
<div class="wrap clearfix">
    <ul class="main-alter clearfix">
        <li class="main-alter-itme"><a href="#home" class="home-alter">首页</a></li>
        <li class="main-alter-itme"><a href="#user">用户管理</a></li>
        <li class="main-alter-itme"><a href="#news">新闻分类</a></li>
        <li class="main-alter-itme"><a href="#goods">用品分类</a></li>
        <li class="main-alter-itme"><a href="#carts">购物车管理</a></li>
    </ul>
    <div class="main-content clearfix">
        <div id="home" class="alter">
            欢迎您！管理员
        </div>
        <div id="user" class="alter">
            <!-- 请管理你的用户 -->
            <%!
                User user=null;
            %>
            <%
                ArrayList<User> users= UserManager.displayAllUser();
                if (users!=null)
                {
                    for(int i=0;i<users.size();i++)
                    {
                        user=users.get(i);
            %>
                        <div class="use">
                            <div class="use-name"><%=user.getUsername()%></div>
                            <div class="use-passwd"><%=user.getPasswd()%></div>
                            <div class="use-email"><%=user.getEmail()%></div>
                            <div class="use-truename"><%=user.getTrueName()%></div>
                            <div class="use-age"><%=user.getAge()%></div>
                            <a href="deleteusers.go?id=<%=user.getUsername()%>"><button class="use-delete">删除</button></a>
                            <a href="addUsers.jsp?id=<%=user.getUsername()%>"><button class="use-update">修改</button></a>
                        </div>
            <%
                    }
                }
            %>
            <a href="addUsers.jsp"><button class="use-add">添加用户</button></a>
        </div>
        <div id="news" class="alter">
            <%!
                Introduces introduce=null;
            %>
            <%
                ArrayList<Introduces> introduces= introducesManager.displayAllIntroduce();
                if (introduces!=null)
                {
                    for(int i=0;i<introduces.size();i++)
                    {
                        introduce=introduces.get(i);
            %>
            <div class="new">
                <div class="new-id"><%=introduce.getId()%></div>
                <div class="new-kind"><%=introduce.getKind()%></div>
                <div class="new-title"><%=introduce.getTitle()%></div>
                <div class="new-content"><%=introduce.getContent()%></div>
                <div class="new-img"><%=introduce.getImg()%></div>
                <a href="deleteintroduces.go?id=<%=introduce.getId()%>"><button class="new-delete">删除</button></a>
                <a href="addIntroduce.jsp?id=<%=introduce.getId()%>"><button class="new-update">修改</button></a>
            </div>
            <%
                    }
                }
            %>
            <a href="addIntroduce.jsp"><button class="new-add">添加信息</button></a>
        </div>
        <div id="goods" class="alter">
            <!-- 请管理你的用品 -->
            <%!
                Goods good=null;
            %>
            <%
                ArrayList<Goods> goods= goodsManager.displayAllGood();
                if (goods!=null)
                {
                    for(int i=0;i<goods.size();i++)
                    {
                        good=goods.get(i);
            %>
                        <div class="good">
                            <div class="good-id"><%=good.getId()%></div>
                            <div class="good-kind"><%=good.getKind()%></div>
                            <div class="good-title"><%=good.getTitle()%></div>
                            <div class="good-brief"><%=good.getBrief()%></div>
                            <div class="good-price"><%=good.getPrice()%></div>
                            <div class="good-img"><%=good.getImg()%></div>
                            <a href="deletegoods.go?id=<%=good.getId()%>"><button class="good-delete">删除</button></a>
                            <a href="addGoods.jsp?id=<%=good.getId()%>"><button class="good-update">修改</button></a>
                        </div>
            <%
                    }
                }
            %>
            <a href="addGoods.jsp"><button class="good-add">添加用品</button></a>
        </div>
        <div id="carts" class="alter">
<%--            请管理购物车--%>
                <%!
                    Cart cart=null;
                %>
                <%
                    ArrayList<Cart> carts= cartManager.displayAllCart();
                    if (carts!=null)
                    {
                        for(int i=0;i<carts.size();i++)
                        {
                            cart=carts.get(i);
                %>
                            <div class="cart">
                                <div class="cart-owner"><%=cart.getOwner()%></div>
                                <div class="cart-content"><%=cart.getContent()%></div>
                                <div class="cart-total"><%=cart.getTotal()%></div>
                                <a href="deletecart.go?id=<%=cart.getOwner()%>"><button class="cart-delete">删除</button></a>
<%--                                <a href="addGoods.jsp?id=<%=cart.getOwner()%>"><button class="cart-delete">修改</button></a>--%>
                            </div>
                <%
                        }
                    }
                %>
<%--                <a href="addCart.jsp"><button class="cart-add">添加用品</button></a>--%>
        </div>
    </div>
</div>
</body>

</html>